home *** CD-ROM | disk | FTP | other *** search
- head 1.4;
- access;
- symbols
- RELEASE:1.3;
- locks; strict;
- comment @ * @;
-
-
- 1.4
- date 91.07.01.17.28.32; author paul; state Exp;
- branches;
- next 1.3;
-
- 1.3
- date 91.06.25.23.50.15; author paul; state Exp;
- branches;
- next 1.2;
-
- 1.2
- date 91.03.06.18.11.48; author paul; state Exp;
- branches;
- next 1.1;
-
- 1.1
- date 91.02.19.17.03.50; author paul; state Exp;
- branches;
- next ;
-
-
- desc
- @Header munching routines.
- @
-
-
- 1.4
- log
- @Replaced most #include statements with a single #include "sendmail.h".
- @
- text
- @/*
- ** HEADER -- Header line parser.
- ** Copyright (c) 1985 Lennart Lovstrand
- ** CIS Dept, Univ of Linkoping, Sweden
- **
- ** Use it, abuse it, but don't sell it.
- **
- ** Version of 14-Apr-85.
- */
-
- #include "sendmail.h"
-
- #define HH_CC "cc"
- #define HH_FROM "from"
- #define HH_MESSAGE_ID "message_id"
- #define HH_RETURN_PATH "return-path"
- #define HH_TO "to"
- #define HH_VIA "via"
-
- #define COMMA ','
-
- #define MAKELC(C) (isupper(C) ? tolower(C) : C)
-
- #ifndef lint
- static char Rcsid[] = "@@(#)$Id: header.c,v 1.3 1991/06/25 23:50:15 paul Exp paul $";
- #endif /* !lint */
-
- #ifdef __STDC__
- int iskey(const char *, const char *);
- char * eat(char *, int);
- char * extract_address(char *, char *);
- #else /* !__STDC__ */
- # define const
- int iskey();
- char * eat();
- char * extract_address();
- #endif /* __STDC__ */
-
- /*
- * iskey: checks if the line is prefixed by
- * the supplied keyword (immediately followed by
- * a colon)
- */
- iskey(key, line)
- const char *key, *line;
- {
- for (; *key != NULL && *line != NULL; key++, line++)
- if (MAKELC(*key) != MAKELC(*line))
- break;
-
- return *key == NULL && *line == ':';
- }
-
- char *
- eat(str, ch)
- char *str, ch;
- {
- for(; *str == ch; str++);
- return str;
- }
-
- /*
- * extract_address:
- * finds and extracts the machine address part of an address field
- */
-
- char *
- extract_address(field, address)
- char *field, *address;
- {
- char *address_start = address;
-
- while(*field && *field != COMMA && *field != '>')
- switch (*field) {
- case '<':
- return extract_address(field, address_start);
- case '(':
- while (*field && *field != ')');
- field++;
- break;
- case '"':
- do
- *address++ = *field++;
- while (*field && *field != '"');
- if (*field)
- *address++ = *field++;
- break;
- case ' ':
- *address++ = *field++;
- field = eat(field, ' ');
- break;
- case '\\':
- *address++ = *field++;
- /* fall through */
- default:
- *address++ = *field++;
- }
- *address = NULL;
- if (*field)
- return index(field, COMMA)+1;
- else
- return field;
- }
- @
-
-
- 1.3
- log
- @Added Rcsid[] string.
- @
- text
- @d11 1
- a11 5
- #include <stdio.h>
- #include <sys/types.h>
- #include <strings.h>
- #include <ctype.h>
- #include "useful.h"
- d13 6
- a18 6
- #define H_CC "cc"
- #define H_FROM "from"
- #define H_MESSAGE_ID "message_id"
- #define H_RETURN_PATH "return-path"
- #define H_TO "to"
- #define H_VIA "via"
- d25 1
- a25 1
- static char Rcsid[] = "@@(#)$Id$";
- @
-
-
- 1.2
- log
- @Added #define const (nothing) to make non-ANSI compilers happy.
- @
- text
- @d28 4
- @
-
-
- 1.1
- log
- @Initial revision
- @
- text
- @d33 1
- @
-